Here's some test sql for all the styles. DECLARE @now datetime SET @now = GETDATE() select convert(nvarchar(MAX), @now, 0) as output, ... ... <看更多>
Search
Search
Here's some test sql for all the styles. DECLARE @now datetime SET @now = GETDATE() select convert(nvarchar(MAX), @now, 0) as output, ... ... <看更多>
... <看更多>
On version 2012 or higher you can use the format function to get just year and month, then cast it as an int. On versions prior to 2012 you can do the ... ... <看更多>